public class DEV521_S35_2Extension {
    private ApexPages.StandardSetController controller;
    public DEV521_S35_2Extension(ApexPages.StandardSetController controller) {
        this.controller = controller;
        this.controller.setPageSize(5);
    }
    private integer totalPageNumber;
    public integer getTotalPageNumber(){
        if(totalPageNumber==null){
            calcPageNumber();
        }
        return totalPageNumber;
    }
    private void calcPageNumber(){
        Integer rSize = controller.getResultSize();
        Integer pSize = controller.getPageSize();
        if(Math.mod(rSize, pSize)==0)
            totalPageNumber = rSize/pSize;
        else
            totalPageNumber = rSize/pSize + 1;
    }        

}